import {
	mapGetters
} from "vuex"

// mixins js文件
export default {
	computed: {
		...mapGetters('moduleCart', ['total'])
	},
	onLoad() {
		this.setBadge(this.total)
	},
	methods: {
		setBadge(newVal) {
			uni.setTabBarBadge({
				index: 2,
				text: newVal + ''
			})
		}
	},
	watch: {
		total: function(newVal) {
			this.setBadge(newVal)
		}
	}
}
